package com.zx.mes.hyl.common.util;


import java.util.LinkedHashMap;
import java.util.Map;

/**
 * 查询参数
 * @author hyl
 * @date 2018-1-27
 */
public class Query extends LinkedHashMap<String, Object> {
	private static final long serialVersionUID = 1L;
	/**
	 * 当前页码
	 */
    private int page = 1;
    /**
     * 每页条数
     */
    private int limit = 10;
    /**
     * 常量
     */
    private static final String MYBATIS_PAGE="page";
    private static final String MYBATIS_LIMIT="limit";

    public Query(Map<String, Object> params){
        this.putAll(params);
        //分页参数
        if(params.get(MYBATIS_PAGE)!=null) {
            this.page = Integer.parseInt(params.get(MYBATIS_PAGE).toString());
        }
        if(params.get(MYBATIS_LIMIT)!=null) {
            this.limit = Integer.parseInt(params.get(MYBATIS_LIMIT).toString());
        }

    }


    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getLimit() {
        return limit;
    }

    public void setLimit(int limit) {
        this.limit = limit;
    }

    public void removePageAndLimit(){
        this.remove("page");
        this.remove("limit");
    }
}
